package com.ningxun.rms.web.controller.wechatuser.user;


import com.ningxun.rms.common.core.domain.model.LoginUser;
import com.ningxun.rms.common.utils.SecurityUtils;
import com.ningxun.rms.domain.basewechatuser.BaseWechatUser;
import com.ningxun.rms.domain.vo.WechatUserVO;
import com.ningxun.rms.service.userservice.IBaseWechatUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wechat/user")
public class GetUser {

    @Autowired
    private IBaseWechatUserService baseWechatUserService;

    @GetMapping(value = "/getuserinfo")
    public WechatUserVO getinfoByUserid(){
        LoginUser loginUser = SecurityUtils.getLoginUser();
        Long userId = SecurityUtils.getUserId();
        BaseWechatUser baseWechatUser = baseWechatUserService.selectBaseWechatUserByUserId(userId);
        WechatUserVO wechatUserVO = new WechatUserVO();
        BeanUtils.copyProperties(baseWechatUser, wechatUserVO);
        return wechatUserVO;
    }
}
